<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCouponLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupon_logs', function (Blueprint $table) {
            $table->id();
            $table->string('name')->nullable()->comment('优惠券名称');
            $table->integer('coupon_id')->default(0)->comment('优惠券id');
            $table->tinyInteger('status')->default(0)->comment('使用状态：0，未使用，1已经使用，4已经过期');
            $table->string('openid')->nullable()->comment('使用者openid');
            $table->decimal('price',10,2)->default(0.00)->comment('优惠券面额');
            $table->string('nick_name')->nullable()->comment('使用者昵称');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupon_logs');
    }
}
